// Create an Apex method to retrieve the recent replies marked as unread in all communities 
    
public class IdeasController {

   public Idea[] getUnreadRecentReplies() {
       Idea[] recentReplies;
       if (recentReplies == null) {
           Id[] recentRepliesIds = Ideas.getUnreadRecentReplies(UserInfo.getUserId(), '');
           recentReplies = [SELECT Id, Title FROM Idea WHERE Id IN :recentRepliesIds];
       }
       return recentReplies;                                                                      
  }

}